package com.t3go.t3_map.base;

import android.content.Context;

import androidx.annotation.NonNull;

import com.shareware.common.utils.LogExtKt;

import java.util.Map;

import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.StandardMessageCodec;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.plugin.platform.PlatformViewFactory;

/**
 * @author
 */
public class T3FMapPlatformViewFactory extends PlatformViewFactory {
    private static final String CLASS_NAME = "T3FMapPlatformViewFactory";
    private final BinaryMessenger binaryMessenger;
    private final LifecycleProvider lifecycleProvider;

    public T3FMapPlatformViewFactory(BinaryMessenger binaryMessenger, LifecycleProvider lifecycleProvider) {
        super(StandardMessageCodec.INSTANCE);
        this.binaryMessenger = binaryMessenger;
        this.lifecycleProvider = lifecycleProvider;
    }

    @NonNull
    @Override
    public PlatformView create(Context context, int viewId, Object args) {
        LogExtKt.log(CLASS_NAME, "create PlatformView");
        Map<String, Object> params;
        try {
            params = (Map<String, Object>) args;
            LogExtKt.log(CLASS_NAME, "create params==>" + params);

        } catch (Throwable e) {
            LogExtKt.logStackTrace(CLASS_NAME, e);
        }
        return new T3FMapPlatformView(viewId, context, binaryMessenger, lifecycleProvider, args);
    }
}
